from pprint import pprint
from wsgiref.simple_server import make_server


def application(environ: dict, start_response: callable):

    print(type(environ))
    pprint(environ)
    # 参数1: 响应状态码, Status Code
    # 参数2: 响应头, Response Headers
    start_response('200 ok', [
        ('Content-Type', 'text/html;charset=utf-8'),
        ('aaa', 'bbb')
    ])
    return [b'<h1>hello world</h1>', b'<hr>', '你好世界'.encode()]


server = make_server('', 8080, application)
server.serve_forever()
